aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/pages/raw/[hash].js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/pages/raw/[hash].js')
-rw-r--r--frontend/src/pages/raw/[hash].js26
1 files changed, 26 insertions, 0 deletions
diff --git a/frontend/src/pages/raw/[hash].js b/frontend/src/pages/raw/[hash].js
new file mode 100644
index 0000000..9edde36
--- /dev/null
+++ b/frontend/src/pages/raw/[hash].js
@@ -0,0 +1,26 @@
+import React from 'react';
+import resolvePaste from "../../http/resolvePaste";
+import {CodeLike} from "../../components/Common/mixins";
+import styled from 'styled-components'
+import NextHead from "../../components/NextHead";
+
+const RawText = styled.pre`
+ ${CodeLike}
+ padding: 0 1em;
+`
+
+export async function getServerSideProps(ctx) {
+ const data = await resolvePaste(ctx.params.hash)
+ return { props: { ...data } }
+}
+
+const Raw = ({error, data}) => {
+ return <>
+ {!error && <NextHead data={data} />}
+ <RawText>
+ {data?.content || error}
+ </RawText>
+ </>
+}
+
+export default Raw \ No newline at end of file